<!DOCTYPE HTML>
<html lang="en" >
    <!-- Start book  -->
    <head>
        <!-- head:start -->
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>弹性盒子 | </title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.css">
        
    
        
        <link rel="stylesheet" href="../../../gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="../../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../../md/CSS/idea/readme.html" />
    
    
    <link rel="prev" href="../../../md/CSS/style/xiaojiao.html" />
    

        <!-- head:end -->
    </head>
    <body>
        <!-- body:start -->
        
    <div class="book"
        data-level="2.3.12"
        data-chapter-title="弹性盒子"
        data-filepath="md/CSS/style/flex.md"
        data-basepath="../../.."
        data-revision="Tue Sep 19 2017 14:58:58 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="md/HTML5/readme.html">
            
                
                    <a href="../../../md/HTML5/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        HTML
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="md/HTML5/20170719HTML.html">
            
                
                    <a href="../../../md/HTML5/20170719HTML.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        什么是HTML
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="md/HTML5/biaoqian.html">
            
                
                    <a href="../../../md/HTML5/biaoqian.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="md/HTML5/form.html">
            
                
                    <a href="../../../md/HTML5/form.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="md/HTML5/form-type.html">
            
                
                    <a href="../../../md/HTML5/form-type.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        form标签的类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="md/HTML5/20170721HTML.html">
            
                
                    <a href="../../../md/HTML5/20170721HTML.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        其他标签的使用
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="md/CSS/readme.html">
            
                
                    <a href="../../../md/CSS/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        CSS3
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="md/CSS/20170722CSS.html">
            
                
                    <a href="../../../md/CSS/20170722CSS.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        什么是CSS
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="md/CSS/selector.html">
            
                
                    <a href="../../../md/CSS/selector.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        选择器
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="md/CSS/selector/tongpei.html">
            
                
                    <a href="../../../md/CSS/selector/tongpei.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.1.</b>
                        
                        通配选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.2" data-path="md/CSS/selector/yuansu.html">
            
                
                    <a href="../../../md/CSS/selector/yuansu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.2.</b>
                        
                        元素选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.3" data-path="md/CSS/selector/qunzu.html">
            
                
                    <a href="../../../md/CSS/selector/qunzu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.3.</b>
                        
                        群组选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.4" data-path="md/CSS/selector/guanxi.html">
            
                
                    <a href="../../../md/CSS/selector/guanxi.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.4.</b>
                        
                        关系选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.5" data-path="md/CSS/selector/shuxing.html">
            
                
                    <a href="../../../md/CSS/selector/shuxing.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.5.</b>
                        
                        属性选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.6" data-path="md/CSS/selector/weilei.html">
            
                
                    <a href="../../../md/CSS/selector/weilei.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.6.</b>
                        
                        伪类选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.7" data-path="md/CSS/selector/weiduixiang.html">
            
                
                    <a href="../../../md/CSS/selector/weiduixiang.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.7.</b>
                        
                        伪对象选择器
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="md/CSS/style/readme.html">
            
                
                    <a href="../../../md/CSS/style/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        常用样式分类
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="md/CSS/style/font.html">
            
                
                    <a href="../../../md/CSS/style/font.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.1.</b>
                        
                        字体样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.2" data-path="md/CSS/style/box.html">
            
                
                    <a href="../../../md/CSS/style/box.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.2.</b>
                        
                        盒子模型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.3" data-path="md/CSS/style/border.html">
            
                
                    <a href="../../../md/CSS/style/border.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.3.</b>
                        
                        边框样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.4" data-path="md/CSS/style/paragraph.html">
            
                
                    <a href="../../../md/CSS/style/paragraph.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.4.</b>
                        
                        段落样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.5" data-path="md/CSS/style/background.html">
            
                
                    <a href="../../../md/CSS/style/background.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.5.</b>
                        
                        背景样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.6" data-path="md/CSS/style/float.html">
            
                
                    <a href="../../../md/CSS/style/float.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.6.</b>
                        
                        浮动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.7" data-path="md/CSS/style/position.html">
            
                
                    <a href="../../../md/CSS/style/position.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.7.</b>
                        
                        定位
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.8" data-path="md/CSS/style/animation.html">
            
                
                    <a href="../../../md/CSS/style/animation.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.8.</b>
                        
                        动画及过渡效果
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.9" data-path="md/CSS/style/iconfont.html">
            
                
                    <a href="../../../md/CSS/style/iconfont.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.9.</b>
                        
                        外部icon图标库的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.10" data-path="md/CSS/style/sanjiaoxing.html">
            
                
                    <a href="../../../md/CSS/style/sanjiaoxing.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.10.</b>
                        
                        利用border画三角形
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.11" data-path="md/CSS/style/xiaojiao.html">
            
                
                    <a href="../../../md/CSS/style/xiaojiao.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.11.</b>
                        
                        对话框旁边的小角制作
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="2.3.12" data-path="md/CSS/style/flex.html">
            
                
                    <a href="../../../md/CSS/style/flex.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.12.</b>
                        
                        弹性盒子
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="md/CSS/idea/readme.html">
            
                
                    <a href="../../../md/CSS/idea/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        小技巧
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="md/CSS/idea/caret-color.html">
            
                
                    <a href="../../../md/CSS/idea/caret-color.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.1.</b>
                        
                        光标和placeholder颜色
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4.2" data-path="md/CSS/idea/background.html">
            
                
                    <a href="../../../md/CSS/idea/background.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.2.</b>
                        
                        部分背景透明
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="md/mobile/readme.html">
            
                
                    <a href="../../../md/mobile/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        移动端相关
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" >
            
            <span><b>3.1.</b> [媒体特性与Responsive设计]</span>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="md/mobile/viewport.html">
            
                
                    <a href="../../../md/mobile/viewport.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        视口
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="md/mobile/responsive.html">
            
                
                    <a href="../../../md/mobile/responsive.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        响应式网页
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="md/javascript/readme.html">
            
                
                    <a href="../../../md/javascript/readme.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        JavaScript
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="md/javascript/strict.html">
            
                
                    <a href="../../../md/javascript/strict.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        JavaScript的严格模式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="md/javascript/value.html">
            
                
                    <a href="../../../md/javascript/value.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        变量
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" >
            
            <span><b>4.3.</b> [对象]</span>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.3.1" data-path="md/javascript/string.html">
            
                
                    <a href="../../../md/javascript/string.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.1.</b>
                        
                        String
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3.2" data-path="md/javascript/array.html">
            
                
                    <a href="../../../md/javascript/array.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.2.</b>
                        
                        Array
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3.3" data-path="md/javascript/date.html">
            
                
                    <a href="../../../md/javascript/date.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.3.</b>
                        
                        Date
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3.4" data-path="md/javascript/number.html">
            
                
                    <a href="../../../md/javascript/number.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.4.</b>
                        
                        Number
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3.5" data-path="md/javascript/math.html">
            
                
                    <a href="../../../md/javascript/math.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.5.</b>
                        
                        Math
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="md/javascript/yunsuanfu.html">
            
                
                    <a href="../../../md/javascript/yunsuanfu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="md/javascript/yuju.html">
            
                
                    <a href="../../../md/javascript/yuju.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="md/javascript/function.html">
            
                
                    <a href="../../../md/javascript/function.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.6.</b>
                        
                        函数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="md/javascript/time.html">
            
                
                    <a href="../../../md/javascript/time.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.7.</b>
                        
                        定时器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="md/javascript/dom.html">
            
                
                    <a href="../../../md/javascript/dom.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.</b>
                        
                        DOM操作
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.8.1" data-path="md/javascript/search.html">
            
                
                    <a href="../../../md/javascript/search.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.1.</b>
                        
                        查找
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.8.2" data-path="md/javascript/add.html">
            
                
                    <a href="../../../md/javascript/add.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.2.</b>
                        
                        增加
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.8.3" data-path="md/javascript/remove.html">
            
                
                    <a href="../../../md/javascript/remove.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.3.</b>
                        
                        移除
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.9" data-path="md/javascript/HTML-JavaScript.html">
            
                
                    <a href="../../../md/javascript/HTML-JavaScript.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.</b>
                        
                        在HTML中使用JavaScript
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.10" data-path="md/javascript/CSS-javascript.html">
            
                
                    <a href="../../../md/javascript/CSS-javascript.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.10.</b>
                        
                        JavaScript控制样式和属性
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.11" data-path="md/javascript/json.html">
            
                
                    <a href="../../../md/javascript/json.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.11.</b>
                        
                        JSON相关
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../../" ></a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x5F39;&#x6027;&#x76D2;&#x5B50;-flex-box">&#x5F39;&#x6027;&#x76D2;&#x5B50; (flex box)</h1>
<p>&#x7ED9;&#x7236;&#x5143;&#x7D20;&#x8BBE;&#x7F6E;&#x4E86;  <code>display: flex;</code> &#x5176;&#x5B50;&#x5143;&#x7D20;&#x90FD;&#x5E26;&#x6709;&#x5F39;&#x6027;&#x76D2;&#x5B50;&#x7684;&#x7279;&#x6027;</p>
<p><strong>&#x4EE5;&#x4E0B;&#x9ED8;&#x8BA4;x&#x8F74;&#x4E3A;&#x4E3B;&#x8F74;&#xFF0C;&#x4E14;&#x6B63;&#x65B9;&#x5411;&#x4E3A;&#x4E3B;&#x8F74;&#x7684;&#x65B9;&#x5411;</strong></p>
<h2 id="&#x7236;&#x5143;&#x7D20;&#x4E2D;&#x7684;&#x5C5E;&#x6027;&#x8BBE;&#x7F6E;">&#x7236;&#x5143;&#x7D20;&#x4E2D;&#x7684;&#x5C5E;&#x6027;&#x8BBE;&#x7F6E;</h2>
<h3 id="1flexdirection">1.flex-direction</h3>
<p>&#x4E3B;&#x8F74;&#x7684;&#x65B9;&#x5411;</p>
<p><img src="../../../img/flex-1.png" alt="flex-1"></p>
<pre><code class="lang-css"><span class="hljs-class">.baba</span><span class="hljs-rules">{
    <span class="hljs-rule"><span class="hljs-attribute">flex-direction</span>:<span class="hljs-value"> row</span></span>; 
    <span class="hljs-comment">/*
     * row: &#x9ED8;&#x8BA4;&#x7684;&#x65B9;&#x5411;&#xFF0C;x&#x8F74;&#x6B63;&#x65B9;&#x5411;
     * row-reverse: x&#x8F74;&#x8D1F;&#x65B9;&#x5411;
     * column: y&#x8F74;&#x6B63;&#x65B9;&#x5411;
     * column-reverse: y&#x8F74;&#x8D1F;&#x65B9;&#x5411;
     */</span>
}</span>
</code></pre>
<h3 id="2flexwrap">2.flex-wrap</h3>
<p>&#x6362;&#x884C;&#x65B9;&#x5F0F;</p>
<pre><code class="lang-css"><span class="hljs-class">.baba</span><span class="hljs-rules">{
    <span class="hljs-rule"><span class="hljs-attribute">flex-wrap</span>:<span class="hljs-value"> wrap</span></span>;
    <span class="hljs-comment">/*
     * nowarp: &#x9ED8;&#x8BA4;&#x503C;&#xFF0C;&#x4E0D;&#x6362;&#x884C;&#xFF0C;&#x8BE5;&#x60C5;&#x51B5;&#xFF0C;&#x5B50;&#x5143;&#x7D20;&#x53EF;&#x80FD;&#x4F1A;&#x6EA2;&#x51FA;&#x5BB9;&#x5668;
     * wrap: &#x5411;&#x4E0B;&#x6362;&#x884C;&#xFF0C;&#x6EA2;&#x51FA;&#x7684;&#x90E8;&#x5206;&#x4F1A;&#x88AB;&#x653E;&#x7F6E;&#x5230;&#x65B0;&#x884C;&#xFF0C;&#x4E0B;&#x90E8;
     * wrap-reverse: &#x5411;&#x4E0A;&#x6362;&#x884C;&#xFF0C;&#x6EA2;&#x51FA;&#x7684;&#x90E8;&#x5206;&#x4F1A;&#x88AB;&#x653E;&#x7F6E;&#x5230;&#x65B0;&#x884C;&#xFF0C;&#x4E0A;&#x90E8;
     */</span>
}</span>
</code></pre>
<h3 id="3aligncontent">3.align-content</h3>
<p><strong>&#x591A;&#x884C;&#x60C5;&#x51B5;&#x4E0B;</strong>&#xFF0C;&#x5B50;&#x5143;&#x7D20;<strong>&#x6574;&#x4F53;</strong>&#x7684;y&#x8F74;&#x6392;&#x5217;&#x65B9;&#x5F0F;&#xFF0C;&#x628A;&#x6240;&#x6709;&#x5B50;&#x5143;&#x7D20;&#x89C6;&#x4E3A;&#x4E00;&#x4E2A;&#x6574;&#x4F53;&#xFF0C;<strong>&#x5185;&#x90E8;&#x987A;&#x5E8F;&#x4E0D;&#x53D8;</strong></p>
<pre><code class="lang-css"><span class="hljs-class">.baba</span><span class="hljs-rules">{
    <span class="hljs-rule"><span class="hljs-attribute">align-content</span>:<span class="hljs-value"> flex-start</span></span>;
    <span class="hljs-comment">/*
     * stretch: &#x9ED8;&#x8BA4;&#x503C;&#xFF0C;
     * flex-start: &#x6BCF;&#x884C;&#x4E0A;&#x5BF9;&#x9F50;&#xFF0C;&#x4E14;&#x4E0B;&#x4E00;&#x884C;&#x7D27;&#x8DDF;&#x7740;&#x4E0A;&#x4E00;&#x884C;
     * flex-end: &#x6BCF;&#x884C;&#x4E0B;&#x5BF9;&#x9F50;&#xFF0C;&#x4E14;&#x4E0A;&#x4E00;&#x884C;&#x7D27;&#x8DDF;&#x7740;&#x4E0B;&#x4E00;&#x884C;
     * center: &#x6574;&#x4F53;&#x5782;&#x76F4;&#x5C45;&#x4E2D;&#xFF0C;&#x4E14;&#x4E2D;&#x95F4;&#x4E0D;&#x7559;&#x7A7A;&#x9699;
     * space-between: &#x7B2C;&#x4E00;&#x884C;&#x7D27;&#x9760;y&#x8F74;&#x4E0A;&#x65B9;&#xFF0C;&#x6700;&#x540E;&#x4E00;&#x884C;&#x7D27;&#x9760;y&#x8F74;&#x4E0B;&#x65B9;&#xFF0C;&#x5269;&#x4F59;&#x7684;&#x884C;&#x5219;&#x6309;&#x4E00;&#x5B9A;&#x65B9;&#x5F0F;&#x5728;&#x5F39;&#x6027;&#x76D2;&#x7A97;&#x53E3;&#x4E2D;&#x6392;&#x5217;&#xFF0C;&#x4EE5;&#x4FDD;&#x6301;&#x4E24;&#x4E24;&#x4E4B;&#x95F4;&#x7684;&#x7A7A;&#x95F4;&#x76F8;&#x7B49;&#x3002;
     * space-around: &#x5404;&#x884C;&#x4F1A;&#x6309;&#x4E00;&#x5B9A;&#x65B9;&#x5F0F;&#x5728;&#x5F39;&#x6027;&#x76D2;&#x5BB9;&#x5668;&#x4E2D;&#x6392;&#x5217;&#xFF0C;&#x4EE5;&#x4FDD;&#x6301;&#x4E24;&#x4E24;&#x4E4B;&#x95F4;&#x7684;&#x7A7A;&#x95F4;&#x76F8;&#x7B49;&#xFF0C;&#x540C;&#x65F6;&#x7B2C;&#x4E00;&#x884C;&#x524D;&#x9762;&#x53CA;&#x6700;&#x540E;&#x4E00;&#x884C;&#x540E;&#x9762;&#x7684;&#x7A7A;&#x95F4;&#x662F;&#x5176;&#x4ED6;&#x7A7A;&#x95F4;&#x7684;&#x4E00;&#x534A;&#x3002;
     */</span>
}</span>
</code></pre>
<h3 id="4alignitems">4.align-items</h3>
<p>y&#x8F74;&#x4E0A;&#x5404;&#x4E2A;&#x5B50;&#x5143;&#x7D20;&#x7684;&#x5BF9;&#x9F50;&#x65B9;&#x5F0F;&#xFF0C;&#x591A;&#x884C;&#x65F6;&#xFF0C;&#x6BCF;&#x884C;&#x4E4B;&#x95F4;&#x7684;&#x7A7A;&#x95F4;&#x76F8;&#x7B49;</p>
<pre><code class="lang-css"><span class="hljs-class">.baba</span><span class="hljs-rules">{
    <span class="hljs-rule"><span class="hljs-attribute">align-items</span>:<span class="hljs-value"> center</span></span>; 
    <span class="hljs-comment">/*
     * flex-start: &#x9876;&#x90E8;&#x5BF9;&#x9F50;
     * flex-end: &#x5E95;&#x90E8;&#x5BF9;&#x9F50;
     * center: &#x5782;&#x76F4;&#x5C45;&#x4E2D;&#x5BF9;&#x9F50;
     * baseline: &#x57FA;&#x4E8E;&#x57FA;&#x7EBF;&#x5BF9;&#x9F50;
     * stretch: &#x9ED8;&#x8BA4;&#x503C;&#xFF0C;&#x5982;&#x679C;&#x5B50;&#x5143;&#x7D20;&#x672A;&#x8BBE;&#x7F6E;height&#xFF0C;&#x5219;&#x8BE5;&#x5B50;&#x5143;&#x7D20;&#x4F1A;&#x88AB;&#x62C9;&#x4F38;&#x81F3;&#x5BB9;&#x5668;&#x7684;&#x9AD8;&#x5EA6;&#xFF0C;&#x591A;&#x884C;&#x5219;&#x7B49;&#x5206;&#x62C9;&#x4F38;
     */</span>
}</span>
</code></pre>
<h3 id="5justifycontent">5.justify-content</h3>
<p>&#x4E3B;&#x8F74;x&#x8F74;&#x7684;&#x5BF9;&#x9F50;&#x65B9;&#x5F0F;</p>
<pre><code class="lang-css"><span class="hljs-class">.son1</span><span class="hljs-rules">{
    <span class="hljs-rule"><span class="hljs-attribute">justify-content</span>:<span class="hljs-value"> flex-start</span></span>;
    <span class="hljs-comment">/*
     * stretch: 
     * flex-start: &#x9ED8;&#x8BA4;&#x503C;&#xFF0C;&#x5DE6;&#x5BF9;&#x9F50;&#xFF0C;&#x4E14;&#x4E0B;&#x4E00;&#x4E2A;&#x8DDF;&#x7740;&#x8FD9;&#x4E0A;&#x4E00;&#x4E2A;
     * flex-end: &#x53F3;&#x5BF9;&#x9F50;&#xFF0C;&#x4E14;&#x4E0B;&#x4E00;&#x4E2A;&#x8DDF;&#x7740;&#x8FD9;&#x4E0A;&#x4E00;&#x4E2A;
     * center: &#x6574;&#x4F53;&#x6C34;&#x5E73;&#x5C45;&#x4E2D;&#xFF0C;&#x4E14;&#x4E2D;&#x95F4;&#x4E0D;&#x7559;&#x7A7A;&#x9699;
     * space-between: &#x6BCF;&#x884C;&#x7B2C;&#x4E00;&#x4E2A;&#x5B50;&#x5143;&#x7D20;&#x7D27;&#x9760;&#x6700;&#x5DE6;&#x8FB9;&#xFF0C;&#x6700;&#x540E;&#x4E00;&#x4E2A;&#x7D27;&#x9760;&#x6700;&#x53F3;&#x8FB9;&#xFF0C;&#x5269;&#x4F59;&#x7684;&#x5219;&#x6309;&#x4E00;&#x5B9A;&#x65B9;&#x5F0F;&#x5728;&#x5F39;&#x6027;&#x76D2;&#x7A97;&#x53E3;&#x4E2D;&#x6392;&#x5217;&#xFF0C;&#x4EE5;&#x4FDD;&#x6301;&#x4E24;&#x4E24;&#x4E4B;&#x95F4;&#x7684;&#x7A7A;&#x95F4;&#x76F8;&#x7B49;&#x3002;
     * space-around: &#x5404;&#x4E2A;&#x5143;&#x7D20;&#x4F1A;&#x6309;&#x4E00;&#x5B9A;&#x65B9;&#x5F0F;&#x5728;&#x5F39;&#x6027;&#x76D2;&#x5BB9;&#x5668;&#x4E2D;&#x6392;&#x5217;&#xFF0C;&#x4EE5;&#x4FDD;&#x6301;&#x4E24;&#x4E24;&#x4E4B;&#x95F4;&#x7684;&#x7A7A;&#x95F4;&#x76F8;&#x7B49;&#xFF0C;&#x540C;&#x65F6;&#x7B2C;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x5DE6;&#x8FB9;&#x53CA;&#x6700;&#x540E;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x53F3;&#x9762;&#x7684;&#x7A7A;&#x95F4;&#x662F;&#x5176;&#x4ED6;&#x7A7A;&#x95F4;&#x7684;&#x4E00;&#x534A;&#x3002;
     */</span>
}</span>
</code></pre>
<h2 id="&#x5B50;&#x5143;&#x7D20;&#x7684;&#x5C5E;&#x6027;&#x8BBE;&#x7F6E;">&#x5B50;&#x5143;&#x7D20;&#x7684;&#x5C5E;&#x6027;&#x8BBE;&#x7F6E;</h2>
<h3 id="1flexgrow">1.flex-grow</h3>
<p>&#x539F;&#x672C;&#x7684;&#x5BBD;&#x5EA6;&#x57FA;&#x7840;&#x4E0A;&#xFF0C;&#x589E;&#x52A0;&#x3001;&#x5206;&#x914D;&#x5269;&#x4F59;&#x7236;&#x5143;&#x7D20;&#x7684;&#x5BBD;&#x5EA6;&#x3002;</p>
<pre><code class="lang-css"><span class="hljs-class">.son1</span><span class="hljs-rules">{
    <span class="hljs-rule"><span class="hljs-attribute">width</span>:<span class="hljs-value"> <span class="hljs-number">100px</span></span></span>;
    <span class="hljs-rule"><span class="hljs-attribute">flex-grow</span>:<span class="hljs-value"> <span class="hljs-number">2</span></span></span>;
}</span>
<span class="hljs-class">.son2</span><span class="hljs-rules">{
    <span class="hljs-rule"><span class="hljs-attribute">width</span>:<span class="hljs-value"> <span class="hljs-number">100px</span></span></span>;
    <span class="hljs-rule"><span class="hljs-attribute">flex-grow</span>:<span class="hljs-value"> <span class="hljs-number">3</span></span></span>;
}</span>
</code></pre>
<p>&#x5047;&#x8BBE;&#x7236;&#x5143;&#x7D20;&#x5269;&#x4F59;100px&#xFF0C;&#x5219;&#x7ED9;son1&#x5206;&#x914D; 100*(3/5)=60 px &#x7684;&#x5BBD;&#x5EA6;&#xFF0C;son1&#x6700;&#x540E;&#x5BBD;&#x5EA6;&#x4E3A;160px&#x3002;</p>
<h3 id="2flexshrink">2.flex-shrink</h3>
<p>&#x4E0E;flex-grow&#x76F8;&#x53CD;&#xFF0C;&#x539F;&#x672C;&#x7684;&#x5BBD;&#x5EA6;&#x57FA;&#x7840;&#x4E0A;&#xFF0C;&#x51CF;&#x5C11;&#x3001;&#x5206;&#x914D;&#x8D85;&#x51FA;&#x7236;&#x5143;&#x7D20;&#x7684;&#x5BBD;&#x5EA6;&#x3002;</p>
<pre><code class="lang-css"><span class="hljs-class">.son1</span><span class="hljs-rules">{
    <span class="hljs-rule"><span class="hljs-attribute">flex-shrink</span>:<span class="hljs-value"> <span class="hljs-number">2</span></span></span>;
}</span>
<span class="hljs-class">.son2</span><span class="hljs-rules">{
    <span class="hljs-rule"><span class="hljs-attribute">flex-shrink</span>:<span class="hljs-value"> <span class="hljs-number">3</span></span></span>;
}</span>
</code></pre>
<h3 id="3alighself">3.aligh-self</h3>
<p>&#x5355;&#x4E2A;&#x5B50;&#x5143;&#x7D20;&#x7684;y&#x8F74;&#x7684;&#x5BF9;&#x9F50;&#x65B9;&#x5F0F;</p>
<pre><code class="lang-css"><span class="hljs-class">.son1</span><span class="hljs-rules">{
    <span class="hljs-rule"><span class="hljs-attribute">align-self</span>:<span class="hljs-value"> flex-start</span></span>;
    <span class="hljs-comment">/*
     * auto: &#x9ED8;&#x8BA4;&#x503C;&#xFF0C;&#x53C2;&#x7167;&#x7236;&#x5143;&#x7D20;&#x7684;align-items&#x7684;&#x503C;&#xFF0C;&#x5982;&#x65E0;&#xFF0C;&#x5219;&#x503C;&#x4E3A;stretch
     * flex-start: &#x9876;&#x90E8;&#x5BF9;&#x9F50;
     * flex-end: &#x5E95;&#x90E8;&#x5BF9;&#x9F50;
     * center: &#x5782;&#x76F4;&#x5C45;&#x4E2D;&#x5BF9;&#x9F50;&#xFF08;&#x5982;&#x679C;&#x5B50;&#x5143;&#x7D20;&#x7684;height&#x9AD8;&#x4E8E;&#x5BB9;&#x5668;&#xFF0C;&#x5219;&#x4F1A;&#x5411;&#x4E24;&#x4E2A;&#x65B9;&#x5411;&#x6EA2;&#x51FA;&#x76F8;&#x540C;&#x7684;&#x957F;&#x5EA6;&#xFF09;
     * baseline: &#x57FA;&#x4E8E;&#x57FA;&#x7EBF;&#x5BF9;&#x9F50;
     * stretch: &#x4F1A;&#x88AB;&#x62C9;&#x4F38;&#x81F3;&#x5BB9;&#x5668;&#x7684;&#x9AD8;&#x5EA6;&#xFF0C;&#x591A;&#x884C;&#x5219;&#x7B49;&#x5206;&#x62C9;&#x4F38;
     */</span>
}</span>
</code></pre>
<h3 id="4order">4.order</h3>
<p>&#x8BBE;&#x7F6E;&#x8BE5;&#x5143;&#x7D20;&#x51FA;&#x573A;&#x7684;&#x987A;&#x5E8F;</p>
<p><strong>&#x6570;&#x503C;&#x5C0F;&#x7684;&#x6392;&#x524D;&#x9762;</strong></p>
<p>&#x9ED8;&#x8BA4;&#x503C;&#x4E3A;0</p>
<pre><code class="lang-css"><span class="hljs-class">.son1</span><span class="hljs-rules">{
    <span class="hljs-rule"><span class="hljs-attribute">order</span>:<span class="hljs-value"> <span class="hljs-number">3</span></span></span>;
}</span>
</code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../../md/CSS/style/xiaojiao.html" class="navigation navigation-prev " aria-label="Previous page: 对话框旁边的小角制作"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../../md/CSS/idea/readme.html" class="navigation navigation-next " aria-label="Next page: 小技巧"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../../gitbook/app.js"></script>

    
    <script src="../../../gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.js"></script>
    

    
    <script src="../../../gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="../../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../../../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"toggle-chapters":{},"splitter":{},"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        <!-- body:end -->
    </body>
    <!-- End of book  -->
</html>
